import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL), // history: 定义路由的历史模式
  routes: [
    {
      path: '/forum/feedback', // URL 路径匹配模式
      name: 'Feedback', // 路由的命名，便于在代码中引用
      component: () => import("../views/Feedback.vue"), // 当路径匹配时渲染的组件
    },
    {
      path: "/",
      redirect: "/forum/layout", // 重定向到其他路径
    },
    {
      path: "/forum/login",
      name: "Login",
      component: () => import("../views/Login.vue"),
    },
    {
      path: '/forum/register',
      name: 'Register',
      component: () => import("../views/Register.vue"),
    },
    {
      path: '/forum/layout',
      name: 'Layout',
      component: () => import("../views/Layout.vue"),
    },
    {
      path: '/forum/hot',
      name: 'Hot',
      component: () => import("../views/Hot.vue"),
    },
    {
      path: '/forum/board',
      name: 'Board',
      component: () => import("../views/Board.vue"),
    },
    {
      path: '/forum/ranking',
      name: 'Ranking',
      component: () => import("../views/Ranking.vue"),
    },
    {
      path: '/forum/ask',
      name: 'Ask',
      component: () => import("../views/Ask.vue"),
    },
    {
      path: '/forum/help',
      name: 'HelpCenter',
      component: () => import("../views/HelpCenter.vue")
    },
    {
      path: '/forum/detail/:postId',
      name: 'PostDetail',
      component: () => import("../views/PostDetail.vue"),
    },
    {
      path: '/forum/profile',
      name: 'Profile',
      component: () => import("../views/Profile.vue"),
    },
    {
      path: '/forum/post',
      name: 'Post',
      component: () => import("../views/Post.vue"),
    },
    {
      path: '/forum/tag',
      name: 'Tag',
      component: () => import("../views/Tag.vue"),
    },
  ],
})

export default router
